﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Wf5.Engine.Common;
using Wf5.Engine.Business;

using Wf5.Engine.Utility;

namespace Wf5.Engine.Core
{
    /// <summary>
    /// 节点执行器的工厂类
    /// </summary>
    internal class NodeMediatorFactory
    {
        /// <summary>
        /// 创建节点执行器的抽象类
        /// </summary>
        /// <param name="processInstance"></param>
        /// <param name="activity"></param>
        /// <param name="activityResource"></param>
        /// <param name="dataContext"></param>
        /// <returns></returns>
        internal static NodeMediator CreateWorkItemMediator(ActivityForwardContext forwardContext
            )
        {
            if (forwardContext.Activity.IsStartNode)
                return new NodeMediatorStart(forwardContext);
            else if (forwardContext.Activity.IsAutomanticWorkItem)
                return new NodeMediatorAutomantic(forwardContext);
            else
                return new NodeManualMediator(forwardContext);
        }
    }
}
